import { director, SpriteFrame, Vec3 } from "cc";
import { LayerCatAction } from "./LayerCatAction";
import { LayerEmptyAction } from "./LayerEmptyAction";
import { LayerRootAction } from "./LayerRootAction";
import { Key } from "./Enums";
import { TipsAction } from "./TipsAction";
import { BucketAction } from "./BucketAction";
import { gameMgr } from "../gameMgr";
import { gameRevival } from "./gameRevival";


export class Global {

    static start = false;
    static LoadingRate = 0;

    //
    static layer_cat_action: LayerCatAction;
    static layer_root_action: LayerRootAction;
    static layer_empty_action: LayerEmptyAction;
    static main_action: gameMgr;
    // static Show_level_action: ShowLevelAction;

    // static game_over_action: GameOverAction;
    // static coins_action: CoinsAction;
    // static success_action: SuccessAction;
    // static layer_btn_action: LayerBtnAction;
    static tips_action: TipsAction;
    static bucket_action: BucketAction;
    static game_revive:gameRevival;
    // static props_action: PropsAction;

    static dcImgs: SpriteFrame[]= [];
    static boxImgs: SpriteFrame[]= [];
    static paoImgs: SpriteFrame[] = [];
    static zdImgs: SpriteFrame[] = [];

    static guide_number = 0;

    static lastCoin = 0;//sb

    static hole_node_name = "hole"

    /** 加上电池偏移量 */
    static offoset_y = 0;

    static battery_scale : Vec3 = new Vec3(0.8,0.8,0.8);

    static Pause(isPause = true) {
        director.emit(Key.Pause, isPause);
        Global.start = !isPause;
    }


    static cur_lvl_pin_total = 0;
    static cur_lvl_pin_move_num = 0;

    public static init_pin_info(total: number) {
        Global.cur_lvl_pin_total = total;
        Global.cur_lvl_pin_move_num = 0;
    }

    public static pin_prgress_computed(num: number) {
        Global.cur_lvl_pin_move_num += num;
    }


    public static next_level(): number {
        Global.cur_lvl_index++;
        return Global.cur_lvl_index;
    }

    static sound_switch = true;

    //当前获取的的
    static cur_coins = 0;
    //使用道具需要多少
     private static need_coins = 30;

     public static get_need_coins():number{
        return Global.need_coins*Global.cur_lvl_index;
     }

    public static use_coins(c: number) {
        Global.cur_coins = Global.cur_coins - c;
        if (Global.cur_coins < 0) {
            Global.cur_coins = 0;
        }
    }



    /** 当前关卡(索引 从0开始) */
    static cur_lvl_index = 0;
    //从头开始游戏,进行默认设置
    public static restart_default(lvl = 0) {
        Global.cur_lvl_index = lvl;
        Global.cur_coins = 0;

        Global.guide_number = 3;
    }


    //每关开始前调用
    public static every_level_default() {
        Global.cur_lvl_pin_total = 0;
        Global.cur_lvl_pin_move_num = 0;
        //clear bucket container
        Global.bucket_action.clear_container();
    }

    // static our_easing: ITweenOption = { easing: 'quadInOut' };


    static ad_intersitial_id: string;
    static ad_video_id: string;

}

